package io.renren.config;

import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class ImageWebConfig implements WebMvcConfigurer {

    // 改为静态final字段，方便直接使用
    private static final String projectFolder = "D:/upload/repair";

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 改为明确的Windows路径格式
        String fileResourceLocation = "file:///D:/upload/repair/";
        
        // 添加日志输出，方便排查问题
        System.out.println("图片资源路径配置: " + fileResourceLocation);
        
        registry.addResourceHandler("/filePath/**")
                .addResourceLocations(fileResourceLocation);
    }
} 